import request from "@/axios/request";
import url from "@/axios/url";
const { mesUrl, adminUrl } = url();
// 导出url
export const exportUrl = `${mesUrl}mesRequirePlan/export`;
// 分页查询
export function getList(params = {}) {
  return request({
    url: `${mesUrl}mesRequirePlan/pageList`,
    method: "get",
    params,
  });
}
// 新增
export function rowCreate(data = {}) {
  return request({
    url: `${mesUrl}mesRequirePlan/batchAddMesRequirePlan`,
    method: "post",
    data,
  });
}
// 修改
export function rowUpdate(data = {}) {
  return request({
    url: `${mesUrl}mesRequirePlan`,
    method: "put",
    data,
  });
}
// 删除
export function rowDel(id) {
  return request({
    url: `${mesUrl}mesRequirePlan/${id}`,
    method: "put",
  });
}
// 详情
export function rowDetail(id) {
  return request({
    url: `${mesUrl}mesRequirePlan/info/${id}`,
    method: "get",
  });
}
// 排期状态字典
export function getPlanStatusList() {
  return request({
    url: `${adminUrl}dict/type/mes_require_plan_status`,
    method: "get",
  });
}

// 根据主键获取产品需求计划排期情况
export function confirmNumber(id) {
  return request({
    url: `${mesUrl}mesRequirePlan/confirmNumber/${id}`,
    method: "get",
  });
}
// 产品需求计划初步排期
export function planSchedule(data = {}) {
  return request({
    url: `${mesUrl}mesRequirePlan/planSchedule`,
    method: "post",
    data,
  });
}
// 产品需求计划排期完成
export function confirmPlan(data = {}) {
  return request({
    url: `${mesUrl}mesRequirePlan/confirmPlan`,
    method: "post",
    data,
  });
}

// 产品需求计划详情
export function getDetail(id) {
  return request({
    url: `${mesUrl}mesRequirePlan/getDetail/${id}`,
    method: "get",
  });
}
// 产品需求计划获取排期情况
export function getRequirePlanPreList(params) {
  return request({
    url: `${mesUrl}mesRequirePlan/getMesRequireOrderPlanPreList`,
    method: "get",
    params,
  });
}


// 产品需求计划aps排期
export function apsPlanSchedule(data = {}) {
  return request({
    url: `${mesUrl}mesRequirePlan/apsPlanSchedule`,
    method: "post",
    data,
  });
}
